﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
 CodeBehind="Elections.aspx.cs" Inherits="Nivdal.Elections" Theme="SkinFile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:HiddenField ID="ElectionsIdHiddenField" runat="server" />
    <asp:HiddenField ID="LanguageIdHiddenField" runat="server" />
    <asp:HiddenField ID="UserIdHiddenField" runat="server" />
    <asp:HiddenField ID="CountryIdHiddenField" runat="server" />
    
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>    
    <asp:UpdateProgress ID="UpdateProcess1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="ajaxloader">
                <asp:Image ID="ProgressImage" runat="server" ImageUrl="~/Images/ajax-loader.gif" />
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:Panel ID="GeneralElectionsInfoPanel" runat="server">
        <asp:FormView ID="GeneralElectionsInfoFormView" runat="server" DataSourceID="ElectionsInfoDatasource" Width="100%">
        <ItemTemplate>
            <div class="basic_element">
            <div class="red_title_no_padding">
            <div class="grey_title_inside_red floater">
               <asp:Label ID="ElectionsTitleLabel" runat="server" CssClass="white_title" Text='<%# Eval("Title") + " " + Resources.Resource.Global_Season + " " + Eval("Season") %>' ></asp:Label>
            </div>
            <div class="grey_title_triangle floater"></div>
            <asp:Hyperlink ID="CountryLink" runat="server" ImageUrl='<%# "~/Images/Flags/" + Eval("Flag") %>' CssClass="RoundCorners"
            ToolTip='<%# Eval("CountryName") %>' NavigateUrl='<%# "~/Country.aspx?Id=" + Eval("CountryId") %>'></asp:Hyperlink>
            </div>
            <div class="padding5">
            <div class="antifloater" style="padding: 10px 20px 10px 20px;">
                <img alt="secretary" src="Images/Hypo/Secretary5.png" height="100" width="84" />
            </div>
             <asp:Label ID="Otherelections" runat="server" SkinID="InfoLabel" Text="<%$ Resources:Resource, Countries_GoToCountryPageLabel %>"></asp:Label>
             <asp:DropDownList ID="OngoingElectionsDDL" runat="server" DataSourceID="OtherElectionsDataSource" AutoPostBack="true"
              OnSelectedIndexChanged="GoToOtherelections" DataTextField="CountryName" DataValueField="ElectionsId" ></asp:DropDownList>
             <asp:SqlDataSource ID="OtherElectionsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                SelectCommand="Nivdal_ElectionsGetListOfOngoingElections" SelectCommandType="StoredProcedure">
                </asp:SqlDataSource> 
             <br />
             <table>
             <tr>
             <td>
                <asp:Label ID="SignupStartDateTitle" runat="server" Text="<%$ Resources:Resource, Elections_SignupStartDate %>" SkinID="InfoLabel"></asp:Label>
             </td>
             <td>
                <asp:Label ID="SignupStartDateLabel" runat="server" Text='<%# Eval("StartDate") %>' SkinID="GridLabel"></asp:Label>
             </td>
             </tr>
             <tr>
             <td>
                <asp:Label ID="VoteStartDateTitleLabel" runat="server" Text="<%$ Resources:Resource, Elections_VotingStartDate %>" SkinID="InfoLabel"></asp:Label>
             </td>
             <td>
                <asp:Label ID="VoteStartDateLabel" runat="server" Text='<%# Eval("VoteStartDate") %>' SkinID="GridLabel"></asp:Label>
             </td>
             </tr>
             <tr>
             <td>
                <asp:Label ID="FinishDateTitleLabel" runat="server" Text="<%$ Resources:Resource, Elections_FinishDate %>" SkinID="InfoLabel"></asp:Label>
             </td>
             <td>
                <asp:Label ID="FinishDateLabel" runat="server" Text='<%# Eval("FinishDate") %>' SkinID="GridLabel"></asp:Label>
             </td>
             </tr>
             </table>
             </div>
             <div class="clearBoth"></div>
            </div>
        </ItemTemplate>
        </asp:FormView>
        <asp:SqlDataSource ID="ElectionsInfoDatasource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_ElectionsGetInfo" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:ControlParameter ControlID="ElectionsIdHiddenField" PropertyName="Value" Type="Decimal" Name="ElectionsId" />
                <asp:ControlParameter ControlID="LanguageIdHiddenField" PropertyName="Value" Type="Decimal" Name="Language" />
            </SelectParameters>
        </asp:SqlDataSource>                  
    </asp:Panel>   
    <asp:Panel ID="NoElectionsInCountryPanel" runat="server">
        <div class="basic_element">
        <div class="padding5">
            <asp:Label ID="NoelectionsTitleLabel" runat="server" SkinID="SubHeaderLabel" Text="<%$ Resources:Resource, Elections_NoElections %>" ></asp:Label>
        </div>
        </div>
        
        
    </asp:Panel> 
    <asp:Panel ID="SignupPanel" runat="server">
        <div class="basic_element">
        <div class="red_title">
            <asp:Label ID="SpeechTitleLabel" runat="server" CssClass="white_title" Text="<%$ Resources:Resource, Elections_CandidateSpeech %>" ></asp:Label>
        </div>
        <div class="padding5">
            <asp:Label ID="ElectionsSignupTitleLabel" runat="server" SkinID="GridLabel"
            Text="<%$ Resources:Resource, Elections_SignupTitleLabelText %>"></asp:Label>
            <br />
            <CustomControls:TextArea ID="SpeechTextBox" runat="server" TextMode="MultiLine" Height="150"
                Width="500" MaxLength="3500"></CustomControls:TextArea>
            <br />
            <asp:Button ID="CandidacySubmitButton" runat="server" Text="<%$ Resources:Resource, Global_Submit %>" CssClass="GreenSmallButtonStyle"
                OnClick="SubmitCandidacy" />
        </div>
        </div>

    </asp:Panel>
    
    <asp:Panel ID="VotingPanel" runat="server">
        <div class="basic_element">
        <div class="red_title">
           <asp:Label runat="server" ID="VotingPanelTitleLabel" CssClass="white_title" Text="<%$ Resources:Resource, Elections_ElectionsOpenForVotingText %>"></asp:Label>
        </div>
        <div class="padding5">

        <asp:Panel ID="VotedPanel" runat="server">
            <asp:Label ID="VoteLabel" runat="server" Text="<%$ Resources:Resource, Elections_CanVoteText %>" SkinID="InfoLabel"></asp:Label>
            <asp:HyperLink ID="VotedforHyperlink" runat="server" SkinID="GreenTitleHyperLink"></asp:HyperLink>
        </asp:Panel>
        <br />
        <asp:Label ID="ListOfCandidatesTitleLabel" runat="server" SkinID="InfoLabel" 
        Text="<%$ Resources:Resource, Elections_ListOfCandidatestitleLabel %>"></asp:Label>
        <br />
        <asp:HyperLink ID="ListOfSpeechesLink" runat="server" Text="<%$ Resources:Resource, Electsions_CandidatesSpeeches %>" SkinID="GreenTitleHyperLink"></asp:HyperLink>
        <asp:RadioButtonList ID="CandidatesRadioButtonList" runat="server" DataSourceID="VotingDataSource"
         DataTextField="CandidateLink" DataValueField="CandidateId" CssClass="NewsItemStyle"></asp:RadioButtonList>
        <br />
        <asp:Button ID="VoteButton" runat="server" OnClick="SubmitVote" CssClass="GreenSmallButtonStyle"
          Text="<%$ Resources:Resource, Global_Submit %>" />

        <%--<asp:ListView ID="CandidatesListview" runat="server" DataSourceID="VotingDataSource" OnItemCommand="Vote">
        <LayoutTemplate>
            <asp:Label ID="itemplaceholder" runat="server"></asp:Label>
        </LayoutTemplate>
        <ItemTemplate>
            <asp:HiddenField ID="CandidateIdHiddenField" runat="server" Value='<%# Eval("CandidateId") %>' />
            <asp:Image ID="VotedImage" runat="server" Visible='<%# Eval("CandidateId").ToString() == Eval("VoteFor").ToString() %>'
             ImageUrl="~/Images/Icons/vi.png" ToolTip="<%$ Resources:Resource, Elections_YourCandidate %>" />
            
            <asp:HyperLink ID="CandidateLink" runat="server" SkinID="GreenTitleHyperLink"
             Text='<%# Eval("CandidateName") %>' NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("UserId") %>'></asp:HyperLink>
            
            <br />
            <i><asp:Label ID="SpeechTitleLabel" runat="server" Text='<%# Eval("Speech") %>' SkinID="GridLabel"></asp:Label></i>
            <br />
            <asp:LinkButton ID="VoteLink" runat="server" Text='<%# Resources.Resource.Elections_VoteForText + " " + Eval("CandidateName")%>'
              CommandName="Vote" CommandArgument='<%# Eval("CandidateId") %>' SkinID="GreenTitleLink" 
              Visible='<%# (Eval("CandidateId").ToString() != Eval("VoteFor").ToString()) && (CanVote()) %>'></asp:LinkButton>
            <br /><br />
        </ItemTemplate>
        </asp:ListView> --%>       
        <asp:SqlDataSource ID="VotingDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_ElectionsGetListOfCandidates" SelectCommandType="StoredProcedure">
            <%--<SelectParameters>
                <asp:ControlParameter ControlID="ElectionsIdHiddenField" PropertyName="Value" Type="Decimal" Name="ElectionsId" /> 
                <asp:ControlParameter ControlID="UserIdHiddenField" PropertyName="Value" Type="String" Name="UserId" />           
            </SelectParameters>--%>
        </asp:SqlDataSource> 
        
        </div>
        </div>
    </asp:Panel>
    <asp:Panel ID="PanelCandidate" runat="server">
        <div class="basic_element">
        <asp:FormView ID="CandidateFormview" runat="server" DataSourceID="IsCandidateDataSource" Width="100%">
        <ItemTemplate>
            
            <div class="red_title">
               <asp:Label ID="IsCandidateExplanationLabel" runat="server" CssClass="white_title" Text="<%$ Resources:Resource, Elections_YouAreCandidate %>"></asp:Label>
            </div>
            <div class="padding5">
                 <asp:LinkButton ID="EditButton" runat="server" CommandName="Edit"
                 Text="<%$ Resources:Resource, Global_Edit %>" SkinID="GreenTitleLink" ></asp:LinkButton>
                 <br /><br />
                <asp:Label ID="IsApproved" runat="server" SkinId="GridLabel" Visible='<%# Eval("IsApproved") %>'
                 Text="<%$ Resources:Resource, Elections_CandidacyApprovedText %>"></asp:Label>
                <asp:Label ID="PendingApprovalText" runat="server" SkinID="GridLabel" Visible='<%# !(bool)Eval("IsApproved") %>'
                 Text="<%$ Resources:Resource, Elections_CandidacyPendingApprovalText %>"></asp:Label>
            </div>
            
        </ItemTemplate>
        <EditItemTemplate>
            
            <div class="red_title">
               <asp:Label ID="EditSpeechTitleLabel" runat="server" CssClass="white_title" Text="<%$ Resources:Resource, Elections_CandidateSpeech %>" ></asp:Label>
            </div>
            <div class="padding5">
                <asp:HiddenField ID="CandidateIdHiddenField" runat="server" Value='<%# Bind("CandidateId") %>' />    
                <br />
                <CustomControls:TextArea ID="SpeechTextBox" runat="server" Text='<%# Bind("Speech") %>' TextMode="MultiLine" 
                 Height="150" MaxLength="3500" Width="500"></CustomControls:TextArea>
                <br />
                <asp:Button ID="UpdateButton" runat="server" Text="<%$ Resources:Resource, Global_Update %>"
                 CommandName="Update" CssClass="GreenSmallButtonStyle" />
                <asp:Button ID="CancelButton" runat="server" Text="<%$ Resources:Resource, Global_Cancel %>"
                 CommandName="Cancel" CssClass="GreySmallButtonStyle" />
            </div>
        </EditItemTemplate>
        </asp:FormView>
        <asp:SqlDataSource ID="IsCandidateDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_ElectionsGetCandidateSpeech" SelectCommandType="StoredProcedure"
        UpdateCommand="Nivdal_ElectionsUpdateCandidateSpeech" UpdateCommandType="StoredProcedure">
            <SelectParameters>
                <asp:ControlParameter ControlID="ElectionsIdHiddenField" PropertyName="Value" Type="Decimal" Name="ElectionsId" />
                <asp:ControlParameter ControlID="UserIdHiddenField" PropertyName="Value" Type="String" Name="UserId" />
            </SelectParameters>
        </asp:SqlDataSource>  
        <br /><br />
        <asp:Button ID="WithdrawButton" runat="server" CssClass="GreenSmallButtonStyle"  
        message="<%$ Resources:Resource, Elections_WithdrawWarningText %>" OnClick="WithdrawFromElections"
        OnClientClick='return confirm(this.getAttribute("message"))' Text="<%$ Resources:Resource, Elections_WithdrawTitleText %>" />
        </div>
    </asp:Panel>
    <asp:Panel ID="ElectionsResultsPanel" runat="server">
        
        <div class="basic_element">
        <div class="red_title">
            <asp:Label ID="ElectionsResutlsTitle" runat="server" CssClass="white_title" Text="<%$ Resources:Resource, Elections_ElectionsOverTitle %>"></asp:Label>
        </div>
        <div class="padding5">

            <asp:GridView ID="ResultsGridview" runat="server" AutoGenerateColumns="false" SkinID="Professional"
                DataSourceID="ResutlsDataSource" AllowPaging="false">
                <Columns>
                <asp:TemplateField HeaderText="<%$ Resources:Resource, Elections_CandidateNameTitle %>">
                    <ItemTemplate>
                        <asp:HyperLink ID="CandidateLink" runat="server" SkinID="GreenTitleHyperLink" Text='<%# Eval("CandidateName") %>'
                            NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("UserId") %>'></asp:HyperLink>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="<%$ Resources:Resource, Elections_NumberOfVotes %>">
                    <ItemTemplate>
                        <asp:Label ID="NumVotesLabel" runat="server" SkinID="GridLabel" Text='<%# Eval("NumVotes") %>'></asp:Label>
                        <asp:Image ID="Withdrawn" runat="server" ImageUrl="~/Images/Icons/RedCircle.png" 
                        ToolTip="<%$ Resources:Resource, Elections_UserWithdrawn %>" Visible='<%# Eval("Withdrawn") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                </Columns>
                <EmptyDataTemplate>
                <asp:Label ID="NoVotesLabel" runat="server" SkinID="GridLabel" Text="<%$ Resources:Resource, Elections_NobodyVoted %>"></asp:Label>
                </EmptyDataTemplate>

                </asp:GridView>
                <asp:SqlDataSource ID="ResutlsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                SelectCommand="Nivdal_ElectionsGetCandidates" SelectCommandType="StoredProcedure">
                <SelectParameters>
                    <asp:ControlParameter ControlID="ElectionsIdHiddenField" PropertyName="Value" Type="Decimal" Name="ElectionsId" /> 
                    <asp:ControlParameter ControlID="UserIdHiddenField" PropertyName="Value" Type="String" Name="UserId" />           
                </SelectParameters>
            </asp:SqlDataSource> 
        
        </div>
        </div>
    </asp:Panel>
    <asp:Panel ID="OldElectionsPanel" runat="server">
        <div class="basic_element">
        <div class="red_title">
           <asp:Label ID="CompletedElectionsTitleLabel" runat="server" CssClass="white_title" Text="<%$ Resources:Resource, Elections_CompletedElectionsTitle %>"></asp:Label>
        </div>
        <div class="padding5">

        
            <asp:GridView ID="OldElectionsGridview" runat="server" AutoGenerateColumns="false" SkinID="Professional"
             DataSourceID="CompletedElectionsDataSource" AllowPaging="false">
                <EmptyDataTemplate>
                    <asp:Label ID="NoCompletedElectionsLabel" runat="server" SkinID="GridLabel" Text="<%$ Resources:Resource, Elections_NoCompletedElectionsText %>"></asp:Label>
                </EmptyDataTemplate>
                <Columns>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_Date %>">
                        <ItemTemplate>
                            <asp:Label ID="CompletedDate" runat="server" Text='<%# Eval("CompleteDate") %>' SkinID="GridLabel"></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:HyperLink ID="ElectsionTitleHyperlink" runat="server" NavigateUrl='<%# "~/Elections.aspx?ElectionsId=" + Eval("ElectionsId") %>'
                             Text='<%# Eval("Title") %>' SkinID="GreenTitleHyperLink" ></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_Winner %>">
                        <ItemTemplate>
                            <asp:Label ID="WinnerLabel" runat="server" Text='<%# Eval("ElectionsWinner") %>' SkinID="GreenGridLabel"></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <asp:SqlDataSource ID="CompletedElectionsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_ElectionsGetCompletedElectionsInCountry " SelectCommandType="StoredProcedure">
                <SelectParameters>
                    <asp:ControlParameter ControlID="CountryIdHiddenField" PropertyName="Value" Type="Decimal" Name="CountryId" />
                    <asp:ControlParameter ControlID="LanguageIdHiddenField" PropertyName="Value" Type="Decimal" Name="Language" />                
                </SelectParameters>
            </asp:SqlDataSource> 
        </div>
        </div>
        
    </asp:Panel>
    <asp:Panel ID="CandidatesApprovalPanel" runat="server">
        <div class="basic_element">
        <div class="red_title">
           <asp:Label ID="CandidatesPendingApprovalTitle" runat="server" CssClass="white_title" Text="<%$ Resources:Resource, Elections_ListOfPendingCandidates %>" ></asp:Label>
        </div>
        <div class="padding5">
         <asp:GridView ID="PendingApprovalGridview" runat="server" DataSourceID="PendingApprovalDataSource"
          AllowPaging="false" AutoGenerateColumns="false" SkinID="Professional">
          <EmptyDataTemplate>
            <asp:Label ID="NoCandidatesPendingApproval" runat="server" SkinID="GridLabel"
             Text="<%$ Resources:Resource, Elections_NoPendingCandidates %>"></asp:Label>
          </EmptyDataTemplate>
          <Columns>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Elections_CandidateNameTitle %>" ItemStyle-Width="20%">
                <ItemTemplate>
                    <asp:HyperLink ID="CandidateLink" runat="server" SkinID="GreenTitleHyperLink" Text='<%# Eval("PublicName") %>'
                     NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("UserId") %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>           
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Elections_CandidateSpeech %>" ItemStyle-Width="75%" >
                <ItemTemplate>
                    <asp:Label ID="SpeechLabel" runat="server" Text='<%# Eval("Speech") %>' SkinID="GridLabel"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="5%" >
                <ItemTemplate>
                    <asp:CheckBox ID="ApproveCheckBox" runat="server" />
                    <asp:HiddenField ID="CandidateIdHiddenField" runat="server" Value='<%# Eval("Id") %>' />
                </ItemTemplate>
            </asp:TemplateField>
          </Columns>
          </asp:GridView>
          <asp:Button ID="ApproveSelectedButton" runat="server" OnClick="ApproveSelected" 
          CssClass="GreenSmallButtonStyle" Text="<%$ Resources:Resource, Admin_ApproveSelected %>"  />
         <asp:SqlDataSource ID="PendingApprovalDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_ElectionsGetCandidatesPendingApproval" SelectCommandType="StoredProcedure">
        </asp:SqlDataSource> 
        <br /><br />
        <asp:Label runat="server" ID="AllCandidates" SkinID="InfoLabel" Text="<%$ Resources:Resource, Elections_ListOfCandidatestitleLabel %>"></asp:Label>
        <br />
        <asp:GridView ID="AllCandidatesGridview" runat="server" AutoGenerateColumns="false" SkinID="Professional"
         DataSourceID="AllCandidatesdataSource" AllowPaging="false">
         <Columns>
            <asp:TemplateField ItemStyle-Width="4%">
                <ItemTemplate>
                    <asp:HyperLink ID="ElectionsCountryFlag" runat="server" NavigateUrl='<%# "~/Country.aspx?Id=" + Eval("ElectionsCountryId") %>'
                     ToolTip='<%# Eval("ElectionsCountryName") %>' ImageUrl='<%# "~/Images/Flags/" + Eval("ElectionsFlag") %>'></asp:HyperLink>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:HyperLink ID="ElectionsCountryFlag" runat="server" NavigateUrl='<%# "~/Country.aspx?Id=" + Eval("ElectionsCountryId") %>'
                     ToolTip='<%# Eval("ElectionsCountryName") %>' ImageUrl='<%# "~/Images/Flags/" + Eval("ElectionsFlag") %>'></asp:HyperLink>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField  HeaderText="<%$ Resources:Resource, Elections_CandidateNameTitle %>" ItemStyle-Width="20%">
                <ItemTemplate>
                    <asp:HyperLink ID="CandidateCountryLink" runat="server" NavigateUrl='<%# "~/Country.aspx?Id=" + Eval("CandidateCountryId") %>'
                     ToolTip='<%# Eval("CandidateCountryName") %>' ImageUrl='<%# "~/Images/Flags/" + Eval("CandidateFlag") %>'></asp:HyperLink>

                    <asp:HyperLink ID="CandidateLink" runat="server" SkinID="GreenTitleHyperLink" Text='<%# Eval("UserName") %>'
                     NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("UserId") %>'></asp:HyperLink>
                </ItemTemplate>            
                <EditItemTemplate>
                    <asp:HyperLink ID="CandidateCountryLink" runat="server" NavigateUrl='<%# "~/Country.aspx?Id=" + Eval("CandidateCountryId") %>'
                     ToolTip='<%# Eval("CandidateCountryName") %>' ImageUrl='<%# "~/Images/Flags/" + Eval("CandidateFlag") %>'></asp:HyperLink>
                    <asp:HyperLink ID="CandidateLink" runat="server" SkinID="GreenTitleHyperLink" Text='<%# Eval("UserName") %>'
                     NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("UserId") %>'></asp:HyperLink>

                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Elections_CandidateSpeech %>" ItemStyle-Width="62%" >
                <ItemTemplate>
                    <div style="overflow:auto; height:40px;">
                        <asp:Label ID="SpeechLabel" runat="server" Text='<%# Eval("Speech") %>' SkinID="GridLabel"></asp:Label>
                    </div>
                </ItemTemplate>
                <EditItemTemplate>
                    <CustomControls:TextArea ID="SpeechTextBox" runat="server" Text='<%# Bind("Speech") %>' 
                    Width="100%" Height="150" MaxLength="4000" TextMode="MultiLine"></CustomControls:TextArea>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="4%">
                <ItemTemplate>
                    <asp:Image ID="ApprovedImage" runat="server" ImageUrl="~/Images/Icons/vi.png" 
                    Visible='<%# Eval("IsApproved") %>' ToolTip="<%$ Resources:Resource, Global_HasbeenApproved %>" />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:CheckBox ID="ApprovedCheckbox" runat="server" Checked='<%# Bind("IsApproved") %>' />
                    <asp:HiddenField ID="CandidateIdHiddenField" runat="server" Value='<%# Bind("CandidateId") %>' />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:CommandField EditText="<%$ Resources:Resource, Global_Edit %>" CancelText="<%$ Resources:Resource, Global_Cancel %>"
             UpdateText="<%$ Resources:Resource, Global_Update %>" ShowCancelButton="true" ShowDeleteButton="false"
              ShowEditButton="true" ShowInsertButton="false" ShowSelectButton="false" ControlStyle-CssClass="NewsDateStyle" />
         </Columns>       
         </asp:GridView>
         

        </div>
        </div>
    </asp:Panel>
    </ContentTemplate>
    </asp:UpdatePanel>

    <asp:SqlDataSource ID="AllCandidatesdataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_ElectionsGetAllCandidatesForAdmin" SelectCommandType="StoredProcedure"
        UpdateCommand="Nivdal_ElectionsUpdateCandidacyByAdmin" UpdateCommandType="StoredProcedure">
    </asp:SqlDataSource> 
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PageNamePlaceHolder" runat="server">
    <asp:Label ID="PageNameLabel" runat="server" Text="<%$ Resources:Resource, Elections_PageTitle %>" CssClass="PageNameContentStyle"></asp:Label>
</asp:Content>
